package com.sbtr.business.feature.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.feature.entity.FeCanvas;
import com.sbtr.business.feature.dto.FeCanvasDto;

import com.sbtr.business.feature.service.FeCanvasService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.feature.mapper.FeCanvasMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 特征画布字段列表 Service接口实现类
 *
 * @author dgl
 * @since  2023-03-17
 */
@Transactional
@Service
public class FeCanvasServiceImpl extends ServiceImpl<FeCanvasMapper,FeCanvas> implements FeCanvasService {

    @Autowired
    FeCanvasMapper feCanvasMapper;

    @Override
    public PageDto<FeCanvas> pageList(FeCanvasDto feCanvasDto) {

        IPage<FeCanvas> page = new Page<>();
        page.setSize(feCanvasDto.getPageSize());
        page.setCurrent(feCanvasDto.getPage());
        page = feCanvasMapper.selectPages(page, BeanUtil.beanToMap(feCanvasDto));
        PageDto<FeCanvas> r = PageDtoUtils.getPageDtoByIPage(page, FeCanvas.class);

        return r;
    }
}

